use sqlx::MySqlPool;

use std::fs::File;
use std::io::{BufRead, BufReader, Error};

#[derive(Clone, Debug)]
struct Configuration {
    basic_path: String,
    pool: MySqlPool,
}

impl Configuration {
    pub fn new() {}

    //从当前目录读取配置文件
    
    pub fn read_from_configuration_file(&self) -> Self {
        let configuration_path = std::env::current_dir()?.join("configuration");
        println!("configuration path: {}", &configuration_path);
        let file = File::open(&configuration_path).map_err(|error| {
            println!("Read configuration file failed {:?}", error);
            panic!("Error occored when read configuration: {:?}", error);
        });
        let buffer = BufReader::new(file?);
        for line in buffer.lines() {
            let line = line?;
        }
    }
}
